package bma.common.langutil.core;

import java.util.Date;

/**
 * 时间（到秒）数据
 * 
 * @author guanzhong
 * @since 1.0 (imported from BMA.ESP Project)
 * 
 */
public class DateTimeValue extends Date {

	private static final long serialVersionUID = 1L;

	public DateTimeValue() {
		super();
	}

	public DateTimeValue(long date) {
		super(date);
	}

	public Date toDate() {
		return new Date(getTime());
	}

	public void fromDate(Date date) {
		this.setTime(date.getTime());
	}

	public static DateTimeValue valueOf(Date date) {
		if (date == null)
			return null;
		DateTimeValue v = new DateTimeValue(date.getTime());
		return v;
	}

	@Override
	public String toString() {
		return DateTimeUtil.formatDateTime(this);
	}

}
